<?php
header('Content-Type:text/html;charset=gbk');
require_once("db_manage.php");
//require_once './bbs/include/common.inc.php';
session_start();
$username = $_SESSION['username'];
// upload dir	
$id = $_POST['id'];
$intro = $_POST['title'];		
$textlink = $_POST['textlink'];
$turn = $_POST['turn'];
$userfile = $_POST['userfile'];

$uploaddir = './upload/images/';
$uploadfile = date('YmdHis');
$filename = basename($_FILES['userfile']['name']);
$path_parts = pathinfo($filename);
$ext = $path_parts["extension"];
$uploadfile = $uploaddir.$uploadfile.".".$ext;

$pic_edit = $_POST['pic_edit'];
if(is_pic($uploadfile)){
	move_uploaded_file($_FILES['userfile']['tmp_name'],$uploadfile);
}else{
	$uploadfile = $pic_edit;
}	
	$suggest = array($id,$intro,$textlink,$uploadfile,$username,$turn);
	updateSuggest($suggest);	


echo "<script>location.href='manage_home_fspecial.php';</script>";
/*
$uploadfile = $uploaddir . 'jioj.jpg';
echo $uploadfile;
echo '<pre>';
if (move_uploaded_file($_FILES['imageupload']['tmp_name'], $uploadfile)) {
   echo "File is valid, and was successfully uploaded.\n";
} else {
   echo "Possible file upload attack!\n";
}
echo 'Here is some more debugging info:';
print_r($_FILES);
print "</pre>";
*/
?> 